const initialState = {
    data:[],
    childData:[],
    index:0
}

const reducer= (state = initialState, { type, payload }) => {
  let newState = JSON.parse(JSON.stringify(state))
  switch (type) {

  case "GET_LIST":
    newState.data = payload
    newState.childData=payload[0].children
    return newState
  case "SET_V":
    newState.index = payload
    // newState.childData=payload[0].children
    return newState
  case "CHECK_CHILDRENDATA":
    newState.childrenData = newState.data[payload].info
    return newState
  default:
    return newState
  }
}
export default reducer